package com.lzlclass.service.Impl;

import com.lzlclass.dao.UserMapper;
import com.lzlclass.pojo.User;
import com.lzlclass.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;




    @Override
    public List<User> getAll() {
        return userMapper.getAll();
    }

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,propagation = Propagation.REQUIRED)
    public int addUsers(User user) {




        userMapper.addUser(user);
//        System.out.println(1/0);
        userMapper.addUser(new User("测error","测error"));

        return 1;
    }


}
